const {
    test_test3
} = require('../.logic')
const flow = test_test3.create({
    name: 'test_test3',
    debug: {
        topo: 'http://localhost:3000/#/topo/test/www?code=1682235806838'
    },
    "data": function () {
        return {}
    },
    "methods": {
        "a": function (arg) {
            this.$next(arg ? (arg + 'a>') : 'a>')
            console.log('a::',arg,this.$next)
        },
        "b": function (arg) {
            // console.log('b::',arg)
            this.$next(arg ? (arg + 'b>') : 'b>')
        },
        "e": function (arg, info) {
            // console.log('e::',arg)
            this.$next(arg ? (arg + 'e>') : 'e>')
        },
        "d": function (arg) {
            // console.log('d::',info)
            this.$next(arg ? (arg + 'd>') : 'd>')
        },
        "f": function (arg) {
            // console.log('f::',arg)
            this.$next(arg ? (arg + 'f>') : 'f>')
        },
        "h": function (arg) {
            // console.log('h::',arg)
            this.$next(arg ? (arg + 'h>') : 'h>')
        },
        "c": function (arg, info) {
            const condition = ['n1', 'y', 'n'][Math.floor(Math.random() * 3)]
            this.$branch(condition, arg ? (arg + 'c>') : 'c>')

        },
        "g": function (arg, info) {
            const condition = ['y', 'n'][Math.floor(Math.random() * 2)]
            this.$branch(condition, arg ? (arg + 'g>') : 'g>')

        },
        "i": function (arg, info) {
            const condition = ['y', 'n'][Math.floor(Math.random() * 2)]
            this.$branch(condition, arg ? (arg + 'i>') : 'i>')
        },
        origin: function (arg, info) { 
            setInterval(() => {
                console.log('===origin>>', this._args   )
                this.$next(arg + 'origin>')
            }, 1000) 
            
        }
    },
    "onBeforeEach": function (info, root) {},
    "onAfterEach": function (info, root) {},
    onEndEach(arg) {
        console.log('end>>', arg.args)
    }
});
flow.$start('@>');
module.exports = flow;